package com.gzit.myandroid;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;

import com.gzit.utils.AndroidUtils;

public class MyandroidActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		Log.i("MyApplication", "MyandroidActivity created!");

		String deviceId = AndroidUtils.System.genFakeDeviceId();
		((TextView) this.findViewById(R.id.deviceId)).setText(deviceId);
		Log.i("MyApplication", deviceId);

		WebView webview = (WebView) this.findViewById(R.id.web);

		webview.loadUrl("http://news.sohu.com");
		webview.getSettings().setUseWideViewPort(true);
		
		WebSettings setting = webview.getSettings(); 
        setting.setJavaScriptEnabled(true); 
//      setting.setBuiltInZoomControls(true); 
//		webview.setInitialScale(0);
//		setting.setLoadWithOverviewMode(true);
		
		webview.getSettings().setLoadWithOverviewMode(true); 
		webview.getSettings().setUseWideViewPort(true); 

		this.findViewById(R.id.screenShot).setOnClickListener(
				new OnClickListener() {

					@Override
					public void onClick(View v) {

						ScreenShot.shoot(MyandroidActivity.this);

					}
				});

	}

	@Override
	protected void onStop() {
		super.onStop();

		// Log.i("MyApplication", "MyandroidActivity stop!");
	}

}